//
//  statusCellOriginalView.swift
//  Weibo
//
//  Created by 明丽 on 16/1/18.
//  Copyright © 2016年 明丽. All rights reserved.
//

import UIKit
import SnapKit
class statusCellOriginalView: UIView {
    
    @objc private func commentBtnDidClick() {
    let temp = TempViewController()
        navController()?.pushViewController(temp, animated: true)
    
    
    
    
    }
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    //MAKE 设置视图
    private func setupUI(){
        backgroundColor = UIColor.whiteColor()

        addSubview(retweetedButton)
        addSubview(commentButton)
        addSubview(likeButton)
        
        let sepView1 = lineView()
        let sepView2 = lineView()

        addSubview(sepView1)
        addSubview(sepView2)
        //设置约束
        retweetedButton.snp_makeConstraints { (make) -> Void in
            make.left.top.bottom.equalTo(self)
            
        }
        commentButton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedButton.snp_right)
            make.bottom.top.equalTo(self)
            make.width.equalTo(retweetedButton.snp_width)
        }
        likeButton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(commentButton.snp_right)
            make.bottom.equalTo(self)
            make.right.equalTo(self.snp_right)
            make.width.equalTo(commentButton.snp_width)
        }
        //设置约束
        let w: CGFloat = 0.5
        let scale: CGFloat = 0.4

        sepView1.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedButton.snp_right)
            make.centerY.equalTo(self.snp_centerY)
            make.height.equalTo(self.snp_height).multipliedBy(scale)
            make.width.equalTo(w)
        }
        sepView2.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedButton.snp_right)
            make.centerY.equalTo(self.snp_centerY)
            make.height.equalTo(self.snp_height).multipliedBy(scale)
            make.width.equalTo(w)
        }
        //添加点击事件
        commentButton.addTarget(self, action: "commentBtnDidClick", forControlEvents: .TouchUpInside)

    
    }

    //实例化一个uiview返回
    private func lineView() -> UIView{
    
    let v = UIView()
        v.backgroundColor = UIColor.lightGrayColor()

        return v
    }
    
    
    
    //懒加在视图
    //转发微博按钮
    private lazy var retweetedButton: UIButton = UIButton(title:"转发", fontSize: 14, color: UIColor.darkGrayColor(), backImageName: nil,imageName: "timeline_icon_retweet")
    //评论
    private lazy var commentButton: UIButton = UIButton(title:"评论", fontSize: 14, color: UIColor.darkGrayColor(), backImageName: nil,imageName:  "timeline_icon_comment")
    //点赞
     private lazy var likeButton: UIButton = UIButton(title:"点赞", fontSize: 14, color: UIColor.darkGrayColor(), backImageName: nil,imageName:  "timeline_icon_unlike")
    
    
    
    
}
